export default new Vuex.Store({
    // 保存的数据
    state: 
    {
        user:{
            isLogin:false,
            isList:false,
            info:{
                name:''
            },
            loginDialog:{
                visiable:false
            },
            list:{
                index:'1',
                name:'正在获取'
            }
        },
    },
    // 对数据的操作方法
    mutations: 
    {
        saveUser:function(state,name){
           state.user.info.name = name;
           state.user.isLogin = true;
        },
        saveList:function(state,list){
            state.user.list = list;
            state.user.isList = true;
        },
        loginDialgChange(state){
            state.user.loginDialog.visiable = !state.user.loginDialog.visiable;
        }
    },
    plugins: [createPersistedState()]
})